Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reindexing token pool created events when creation and active are different steps #1599

Closed
wants to merge 8 commits into from

Conversation

EnriqueL8
Copy link
Contributor

@EnriqueL8 EnriqueL8 commented Nov 20, 2024

I have a set of token pools created and the first one I created then activate it to be published.

The indexer restarted indexing events from the chain and saw the TokenPoolCreation event for the created pool and then it extract the pool information from the operation and compares that to the existing pool in DB but you get the error

 fftokens event attempt 1: FF10407: Rejected token pool 'f582f2c9-06bb-4f65-8842-39cafba75959' - conflicts with existing: f582f2c9-06bb-4f65-8842-39cafba75959 pid=1 proto=fftokens role=event-loop

This is due to this line of code

return HandlerResult{Action: core.ActionReject, CustomCorrelator: correlator}, i18n.NewError(ctx, coremsgs.MsgDefRejectedConflict, "token pool", pool.ID, existing.ID)
but in the case of this pool being published which is the case here then we can set publish to true.

This throws an error which causes the websocket between FF and Token Connector to disconnect and then it reconnect and gets the same message of TokenPoolCreation and the loop just repeated indefinitely...

I think if the IDs are the same we should just ignore the error and log that we received a duplicate event

@EnriqueL8 EnriqueL8 requested a review from a team as a code owner November 20, 2024 16:49
Copy link

codecov bot commented Nov 20, 2024

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Project coverage is 99.98%. Comparing base (62ee71f) to head (290ea03).
Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
internal/definitions/handler_tokenpool.go 0.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##              main    #1599      +/-   ##
===========================================
- Coverage   100.00%   99.98%   -0.02%     
===========================================
  Files          337      337              
  Lines        29498    29501       +3     
===========================================
  Hits         29498    29498              
- Misses           0        2       +2     
- Partials         0        1       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -92,6 +92,11 @@ func (dh *definitionHandler) handleTokenPoolDefinition(ctx context.Context, stat
}
}

if existing.ID.Equals(pool.ID) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm trying to understand how we got to this point with a duplicate ID. Your description indicates we are processing a TokenPoolCreated event, so we're coming in via eventManager.TokenPoolCreated() and then definitionSender.DefineTokenPool() and then here.

But in eventManager.TokenPoolCreated(), there is a check for an existing pool. Is that check failing to find the existing pool and allowing it to get down to here?

Copy link
Contributor

@awrichar awrichar Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also worth confirming... were you running the latest release (v1.3.2) when you saw this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, running the latest v1.3.2 release

@EnriqueL8
Copy link
Contributor Author

This was an issue of pointing at a different contract address and the catching the conflict was actually useful, so we do not need this change

@EnriqueL8 EnriqueL8 closed this Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants